home *** CD-ROM | disk | FTP | other *** search
/ Programming Languages Suite / ProgramD2.iso / Borland / Borland C++ V5.02 / OWLSRC.PAK / METAFLDC.CPP < prev    next >
Encoding:
C/C++ Source or Header  |  1997-05-06  |  1.3 KB  |  61 lines

  1. //----------------------------------------------------------------------------
  2. // ObjectWindows
  3. // Copyright (c) 1992, 1997 by Borland International, All Rights Reserved
  4. //
  5. //$Revision:   10.7  $
  6. //
  7. // Implementation of class TMetaFileDC, a Metafile DC encapsulation
  8. //----------------------------------------------------------------------------
  9. #include <owl/pch.h>
  10. #if !defined(OWL_DC_H)
  11. # include <owl/dc.h>
  12. #endif
  13.  
  14. OWL_DIAGINFO;
  15.  
  16. //
  17. // Create a regular metafile DC.
  18. //
  19. TMetaFileDC::TMetaFileDC(const char far* filename)
  20. :
  21.   TDC(),
  22.   Enhanced(false)
  23. {
  24.   Handle = ::CreateMetaFile(filename);
  25.   CheckValid();
  26. }
  27.  
  28. //
  29. // Destroy the metafile.
  30. //
  31. TMetaFileDC::~TMetaFileDC()
  32. {
  33.   if (Handle) {
  34.     if (ShouldDelete)
  35.       // Do not restore objects, Metafiles cleanup after themselves
  36.       //
  37. #if defined(BI_PLAT_WIN32)
  38.       if (IsEnhanced())
  39.         ::DeleteEnhMetaFile(CloseEnh());
  40.       else
  41. #endif
  42.         ::DeleteMetaFile(Close());
  43.     Handle = 0;
  44.   }
  45. }
  46.  
  47. #if defined(BI_PLAT_WIN32)
  48. //
  49. // Create an enhanced metafile dc.
  50. //
  51. TMetaFileDC::TMetaFileDC(const TDC& dc, const char far* filename, TRect* rect,
  52.                          const char far* description)
  53. :
  54.   TDC(),
  55.   Enhanced(true)
  56. {
  57.   Handle = ::CreateEnhMetaFile(dc, filename, rect, description);
  58.   CheckValid();
  59. }
  60. #endif  // BI_PLAT_WIN32
  61.